define(function(require, exports, module) {

	"use strict";
	var newAdd = {
		/*选择客户*/
		chioceClient: function(id) {
			mui(id).on("tap", "li", function() {
				var chioceClientName = $(this).children("div").children("div").children(".client-name").html();
				var chioceClientNameId = $(this).attr("data-id");
				sessionStorage.setItem("chioceClientName", chioceClientName);
				sessionStorage.setItem("chioceClientNameId", chioceClientNameId);
			});
		},
		/*选择供应商*/
		supplierChioce: function(id) {
			mui(id).on("tap", "li", function() {
				var chioceSupplierName = $(this).children("div").children("div").children(".companyName").html();
				var chioceSupplierNameId = $(this).attr("data-id");
				sessionStorage.setItem("chioceSupplierName", chioceSupplierName);
				sessionStorage.setItem("chioceSupplierNameId", chioceSupplierNameId);
			});
		},
		/*选择仓库类型*/
		newLibrary: function(id) {
			mui(id).on("tap", "li", function() {
				var libraryName = $(this).children("p").html();
				var libraryNameId = $(this).children("p").attr("data-id");
				sessionStorage.setItem("libraryName", libraryName);
				sessionStorage.setItem("libraryNameId", libraryNameId);
			});
		},
		/*选择计税方式类型*/
		newValorem: function(id) {
			mui(id).on("tap", "li", function() {
				var valoremName = $(this).children("a").html();
				var valoremNameId = $(this).children("a").attr("data-id");
				sessionStorage.setItem("valoremName", valoremName);
				sessionStorage.setItem("valoremNameId", valoremNameId);
			});
		},
		newClient: function(id, id2) {
			/*选择客户类型*/
			mui(id).on("tap", "li", function() {
				var clientName = $(this).children("a").html();
				var clientNameId = $(this).children("a").attr("data-id");
				sessionStorage.setItem("clientName", clientName);
				sessionStorage.setItem("clientNameId", clientNameId);
			});
			/*选择负责人*/
			mui(id2).on("tap", "li", function() {
				var chioceStaff = $(this).children("div").children("div").children(".mui-num").html();
				var chioceStaffId = $(this).attr("data-id");
				sessionStorage.setItem("chioceStaff", chioceStaff);
				sessionStorage.setItem("chioceStaffId", chioceStaffId);
			});

		},
		/*选择账户*/
		newAccount: function(id) {
			mui(id).on("tap", "li", function() {
				var chioceAccountNameName = $(this).children("#accountName").html();
				var chioceAccountNameNameId = $(this).attr("data-id");
				sessionStorage.setItem("chioceAccountNameName", chioceAccountNameName);
				sessionStorage.setItem("chioceAccountNameNameId", chioceAccountNameNameId);
			});
		},
		typeAndUser: 　 function(id, id2) {
			var clientName = sessionStorage.getItem("clientName");
			var clientNameId = sessionStorage.getItem("clientNameId");
			var val = $(id).html();
			if(!clientName || clientName == "undefined") {
				if(!val) {
					$(id).html("(必选)");
				} else {
					$(id).html(val);
				}
			} else {
				$(id).html(clientName);
				$(id).attr("data-id", clientNameId);
			}

			var chioceStaff = sessionStorage.getItem("chioceStaff");
			var chioceStaffId = sessionStorage.getItem("chioceStaffId");
			var val1 = $(id2).html();
			if(!chioceStaff || chioceStaff == "undefined") {
				if(!val1) {
					$(id2).html("(必选)");
				} else {
					$(id2).html(val1);
				}
			} else {
				$(id2).html(chioceStaff);
				$(id2).attr("data-id", chioceStaffId);

			}
		}
	};
	module.exports = newAdd;

});